<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>用户修改页面</title>
<link href="skins/style.css" rel="stylesheet" type="text/css">
<jsp:include page="/base.jsp"></jsp:include>
</head>
<body>
<%@include file="top.jsp"%>
<table class="yrh">
	<tr>
		<td height="17"><a href="index.jsp">主页</a> &raquo; 个人信息维护</td>
	</tr>
</table>
<form action="UserDoUpdateServlet" method="post" enctype="multipart/form-data">
<table class="inputTable">
	<tr>
		<td class="inputTitle">个人信息修改</td>
	</tr>
	<tr>
		<td>
		<table class="inputbox">
			<tr>
				<td width="20%" align="right">用户昵称：</td>
				<td width="38%"><input class="text width100" name="userName"
					value="${user.userName}" maxlength="25" >
				</td>
				<td width="41%">&nbsp;<font color="#CC0000">*&nbsp;可选项</font></td>
			</tr>
			<tr>
				<td align="right">原始密码：</td>
				<td><input type="password" class="text width100" value=""
					name="userOldPass" maxlength="25" id="oldPass"></td>
				<td>&nbsp;<font color="#CC0000" id="passFont">*&nbsp;必输项</font></td>
			</tr>
			<tr>
				<td align="right">新&nbsp;&nbsp;密&nbsp;&nbsp;码：</td>
				<td><input type="password" class="text width100"
					name="userNewPass" maxlength="25" id="passId"></td>
				<td>&nbsp;<font color="#CC0000">*&nbsp;必输项</font></td>
			</tr>

			<tr>
				<td align="right">密码确认：</td>
				<td><input type="password" class="text width100"
					name="passwordConfirm" id="confirmId" maxlength="25"></td>
				<td>&nbsp;<font color="#CC0000" id="confirmFont">*&nbsp;必输项</font></td>
			</tr>
			<tr>
				<td align="right">用户头像：</td>
				<td><input type="file" class="text width100" name="userAvatar" 
					maxlength="25"></td>
				<td><font color="#CC0000">&nbsp; &nbsp;可选项</font></td>
			</tr>
			<tr>
				<td colspan="3" align="center"><input type="reset" class="bt2"
					value="重置" /> <input type="submit" class="bt2" value="提交" id="btn_submit"/> <input
					type="button" class="bt2" value="返回"
					onclick="javascript:window.location.href='index.jsp'" /></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
<%@include file="bottom.jsp" %>
</body>
<script type="text/javascript"  src="jQuery/jquery-3.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('#confirmId').on('blur',function(){
		var confirmVal = $(this).val();
		var passVal = $('#passId').val();
		if (confirmVal == passVal) {
			$('#confirmFont').text("两次密码相同");
		}else{
			$('#btn_submit').on('click',function(){
				return false;
				
			})
			$('#confirmFont').text("两次密码不同，请重新输入");
		}
	})
})

	$(document).ready(function(){
		$('#oldPass').on('blur',function(){
			var oldPassVal = $(this).val();
			if (oldPassVal != null && oldPassVal != '') {
				$.ajax({
					type:'get',
					url:'UserCheckPasswordServlet',
					data:{'userOldPass':oldPassVal},
					success:function(result){
						if (result == 1) {
							$('#passFont').text("原密码输入正确");
						}else{
							$('#btn_submit').on('click',function(){
								return false;
								
							})
							$('#passFont').text("原始密码错误，请重新输入");
							
						}
					}
				})
			}
		})
	})


</script>





</html>